#ifndef TRACKPROGRESSION_H
#define TRACKPROGRESSION_H

#include<QList>
#include<QPointer>

class Song;

class TrackProgression{
public:
	enum ProgressionType{
		Default,
		Random,
	};
	enum RepeatType{
		NoRepeat,
		RepeatOne,
		RepeatAll,
	};
	
	TrackProgression(QList< QPointer<Song> > *songs);
	virtual ~TrackProgression();
	
	//Control functions. Should be enough, I guess.
	//Return update to set current() to next song. Return false if should stop playing.
	virtual bool next()=0;
	//Set current() to previously played song.
	virtual void previous()=0;
	//Index of current song in list.
	virtual int current()=0;
	//Force current song to index
	virtual void setIndex(short int index)=0;
	
	//Helper functions
	virtual void songAdded(QPointer<Song>) {}
	virtual void songRemoved(QPointer<Song>) {}
	virtual void cleared() {}
	
	//Definition functions
	virtual ProgressionType progressionType()const=0;
	virtual RepeatType repeatType()const=0;
	
	const char *progressionText()const;
	const char *repeatText()const;
	
	static TrackProgression *getTrackProgression(QList<QPointer<Song> > *songs, ProgressionType progression = Default, RepeatType repeat = NoRepeat);
protected:
	QList< QPointer<Song> >* m_songs;
};

#endif
